<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
        .out{
            width:40%;
            margin:auto;
            border:1px solid red;
        }
        span{
            width: 100px;
            text-align: justify;
            float: left;
            /*display: inline-block;*/
            backg
        }
        span:after{
            content:'.';
            width: 100%;
            display: inline-block;
            overflow: hidden;
            height: 0;
        }
        input{
            width: 150px;
        }
        .demo div{
            width:150px;
            height:20px;
            font-size:12px;
            margin-left: 50px;
            border:1px solid red;
            padding:5px;
        }
        hr{
            height:5px;
            background-color: #626262;
        }
        .submit{
            margin-left: 40%;
        }
    </style>
</head>
<body>
    <div class="out">
    <span>姓名</span>
    ：<input type="text" class="name" />
    <br/><br/>
    <span>工作部门</span>
            <select name="employee.d_id" class="departement">
              <option></option>
              <option value="1">1</option>
              <option value="2">2</option>
    </select>
    <br/><br/>
    <span>奖惩原因</span>
    ：<input type="text" class="rewardcause" />
    <br/><br/>
    <span>奖金</span>
    ：<input type="text" class="rewardnumber" />
    <br/><br/>
    <span>罚金</span>
    ：<input type="text" class="punishnumber" />
    <br/><br/>
    <span>奖惩日期</span>
    ：<input type="text" class="date" />
    <br/><br/>
    <span>备注</span>
    ：<input type="text" class="note" />
    <br/><br/>
    <button class="submit" onclick="submit()">提交</button>
</body>
<script type="text/javascript" src="../JS/jquery.1.9.1.js"></script>
<script>
function submit(){
	var name=$(".name").val();
	var departement=$(".departement").val();
	var rewardcause=$(".rewardcause").val();
	var rewardnumber=$(".rewardnumber").val();
	var punishnumber=$(".punishnumber").val();
	var note = $(".note").val();
	var date = $(".date").val();
	$.ajax({
	   type:"post",
	   url :"../rewardAndpunishAdd.action",
	   data:{
		   name:name,
		   departement:departement,
		   "rewardAndPunish.reward_cause":rewardcause,
		   "rewardAndPunish.reward_number":rewardnumber,
		   "rewardAndPunish.punish_number":punishnumber,
		   "rewardAndPunish.note":note,
	       "rewardAndPunish.date":date,
	   },
	   dataType:"json",
	   success:function(data){
		    if(data=="成功"){
		    	alert("录入成功");
		    }else{
		    	alert("录入失败");
		    }
	   },
	   error:function(){
		   alert("失败");
	   }
	});	
}

</script>
</html>